# Maintainer: Muflone http://www.muflone.com/contacts/english/

pkgname=dbeaver-plugin-apache-poi
pkgver=4.1.1
pkgrel=4
pkgdesc='DBeaver library for Microsoft Office documents'
arch=('any')
url='https://dbeaver.io/'
license=('Apache')
makedepends=('unzip')
depends=('dbeaver>=4.2.5')
source=("https://dbeaver.io/update/ce/latest/plugins/org.jkiss.bundle.apache.poi_${pkgver}.jar"
        "${pkgname}.info")
sha256sums=('a6fdaa74f33d6949119b651c78b2efd2ae0a9f6142315e4aba8c43d17758786f'
            '9da9f00866ebf37a9405c36aee46f26f698000aa1b23e1041e4f999df5b2e3f0')
noextract=("org.jkiss.bundle.apache.poi_${pkgver}.jar")

package() {
  # Extract plugin
  install -m 755 -d "${pkgdir}/usr/lib/dbeaver/plugins/org.jkiss.bundle.apache.poi_${pkgver}"
  unzip -q "${srcdir}/org.jkiss.bundle.apache.poi_${pkgver}.jar" \
        -d "${pkgdir}/usr/lib/dbeaver/plugins/org.jkiss.bundle.apache.poi_${pkgver}"

  # Add configuration file (handled by the hook)
  install -m 755 -d "${pkgdir}/etc/dbeaver/bundles.d"
  install -m 644 "${srcdir}/${pkgname}.info" "${pkgdir}/etc/dbeaver/bundles.d/20-${pkgname}.info"
}
